package com.dhcc.bpm.modules.system.wrapper;

import com.dhcc.bpm.common.cache.DictCache;
import com.dhcc.bpm.modules.system.entity.DataScope;
import com.dhcc.bpm.modules.system.vo.DataScopeVO;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;


/**
 * @ClassName DataScopeWrapper
 * @Description 包装类,返回视图层所需的字段
 * @Author sjm
 * @Date 2020/2/21 0021 15:16
 * @Version V1.0
 * @Copyright: 2020 东华软件 . All rights reserved.
 **/
public class DataScopeWrapper extends BaseEntityWrapper<DataScope, DataScopeVO> {

	public static DataScopeWrapper build() {
		return new DataScopeWrapper();
	}

	@Override
	public DataScopeVO entityVO(DataScope dataScope) {
		DataScopeVO dataScopeVO = BeanUtil.copy(dataScope, DataScopeVO.class);
		assert dataScopeVO != null;
		String scopeTypeName = null;
		if(dataScope != null && dataScope.getScopeType() != null){
			scopeTypeName = DictCache.getValue("data_scope_type", dataScope.getScopeType().toString());
		}
		dataScopeVO.setScopeTypeName(scopeTypeName);
		return dataScopeVO;
	}

}
